const { app, BrowserWindow } = require('electron')

function createWindow () {
    const win = new BrowserWindow({
        width: 800,
        height: 500,
        webPreferences: {
            nodeIntegration: false
        }
    })

    // win.loadURL('https://www.baidu.com') // 加载百度
    win.loadFile('index.html') // 加载页面
}

app.whenReady().then(() => {
    createWindow()

    app.on('activate', () => {
        if (BrowserWindow.getAllWindows().length === 0) createWindow()
    })

    const { Tray } = require('electron')
    let tray = null
    tray = new Tray('icon.png')
    tray.setToolTip('摸鱼中...')
})

app.on('window-all-closed', () => {
    if (process.platform !== 'darwin') app.quit()
})

